<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h2>数组变化侦测</h2>
      <ul>
        <li v-for="(item, index) in list">{{ item }}</li>
      </ul>
      <button v-on:click="fn">btn</button>
    </div>

    <script src="./lib/vue3.js"></script>
    <script>
      const { createApp } = Vue;

      createApp({
        data() {
          return {
            list: ["zhangsan", "lisi", "wangwu"],
          };
        },
        methods: {
          fn() {
            // this.list = this.list.push("zhaoliu");
            // this.list.push("zhaoliu");

            // this.list = this.list.concat("zhaoliu");

            this.list = [...this.list, "zhaoliu"];
          },
        },
      }).mount("#app");
    </script>
  </body>
</html>
